package com.fjtic.team.view;

import java.io.IOException;
import java.util.Scanner;



public class TSUtility {
    static Scanner sc = new Scanner(System.in);
    public static char readMenuSelection() throws IOException {

        System.out.println("请输入1-4中的任意字符");
        char MenuNumber = (char) System.in.read();
        return MenuNumber;
    }
    public static int readInt(){

        System.out.println("请输入两位数整数");
        String number = sc.next();
        if(number.length() != 2){
            System.out.println("您输入的不是两位数，请重新输入。");
            number = sc.next();
        }
       int intnumber = Integer.parseInt(number);
        return intnumber;
    }
    public static void readReturn(){
        System.out.println("等待用户输入，按回车退出");
        String scannerNumber = sc.next();
        if(scannerNumber.length() != 0){
            System.out.println("等待用户输入，按回车退出");
            scannerNumber = sc.next();
        }
    }
    public static char readConfirmSelection(){

        System.out.println("请输入Y或N！");
        String scannerNumber = sc.next();
        char charNumber = scannerNumber.toCharArray()[0];
        if(scannerNumber.equals("Y")|scannerNumber.equals("N")){
           charNumber = scannerNumber.toCharArray()[0];
        };
        return charNumber;
    }
}
